﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;

namespace MUD.Network
{
    public class ClientCollection : Collection<AsyncClient>
    {
        internal ClientCollection()
            :base()
        {

        }

        public AsyncClient this[Guid guid]
        {
            get
            {
                foreach (AsyncClient client in this)
                {
                    if (client.Guid == guid)
                    {
                        return client;
                    }
                }
                return null;
            }
        }

        public AsyncClient this[IPAddress address]
        {
            get
            {
                foreach (AsyncClient client in this)
                {
                    if (client.Address == address)
                    {
                        return client;
                    }
                }
                return null;
            }
        }

        public AsyncClient this[SocketAsyncEventArgs args]
        {
            get
            {
                foreach (AsyncClient client in this)
                {
                    if (client.RecieveArgs == args)
                    {
                        return client;
                    }
                }
                return null;
            }
        }
    }
}
